// 移动端全局样式
@mobile-breakpoint: 768px;
@tablet-breakpoint: 1024px;

// 移动端布局优化
.mobile-container {
  @media (max-width: @mobile-breakpoint) {
    padding: 8px !important;
    margin: 0 !important;
  }
}

.mobile-form {
  @media (max-width: @mobile-breakpoint) {
    .el-form-item {
      width: 100% !important;
      margin-bottom: 10px !important;

      .el-form-item__label {
        display: block;
        text-align: left !important;
        margin-bottom: 4px;
        max-width: 48%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .el-form-item__content {
        width: 100% !important;
        margin-left: 0 !important;
        justify-content: flex-end;
      }
    }

    .el-input,
    .el-select,
    .el-date-picker {
      width: 100% !important;
    }

    .el-button {
      // width: 100%;
      margin-bottom: 8px;
      display: flex !important;
      justify-content: center !important;

      &:last-child {
        margin-bottom: 0;
      }
    }
  }
}

// 移动端表格优化
.mobile-table {
  @media (max-width: @mobile-breakpoint) {
    .el-table {
      font-size: 12px;

      .el-table__header {
        font-size: 12px;
      }

      .el-table__body {
        font-size: 12px;
      }

      .el-table__cell {
        padding: 8px 4px !important;
      }
    }

    .el-pagination {
      .el-pagination__sizes {
        display: none;
      }

      .el-pagination__jump {
        display: none;
      }

      .el-pager {
        .number {
          min-width: 28px;
          height: 28px;
          line-height: 28px;
          font-size: 12px;
        }
      }
    }
  }
}

// 移动端卡片样式
.mobile-card {
  @media (max-width: @mobile-breakpoint) {
    .el-card {
      margin-bottom: 12px;
      border-radius: 8px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

      .el-card__header {
        padding: 12px 16px;
        border-bottom: 1px solid #f0f0f0;

        .card-header {
          display: flex;
          justify-content: space-between;
          align-items: center;
          font-weight: 600;
          font-size: 14px;
        }
      }

      .el-card__body {
        padding: 12px 16px;
        .info-row {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 8px;
          font-size: 13px;

          .label {
            font-weight: 500;
            color: #666;
            min-width: 80px;
          }

          .value {
            color: #333;
            text-align: right;
            flex: 1;
          }
        }
      }
    }
    .mobile-field {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      font-size: 13px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      font-size: 13px;

      label {
        font-weight: 500;
        color: #666;
        min-width: 80px;
      }

      span {
        color: #333;
        text-align: right;
        flex: 1;
      }
    }
    .info-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      font-size: 13px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      font-size: 13px;
      span:first-child {
        font-weight: 500;
        color: #666;
        min-width: 80px;
      }
      span:last-child {
        color: #333;
        text-align: right;
        flex: 1;
      }
    }
  }
}

// 移动端按钮组优化
.mobile-button-group {
  @media (max-width: @mobile-breakpoint) {
    display: flex;
    flex-direction: column;
    gap: 8px;

    .el-button {
      width: 100%;
      margin: 0;
    }

    &.horizontal {
      flex-direction: row;
      flex-wrap: wrap;

      .el-button {
        flex: 1;
        min-width: 0;
        margin-right: 8px;

        &:last-child {
          margin-right: 0;
        }
      }
    }
  }
}

// 移动端对话框优化
.mobile-dialog {
  @media (max-width: @mobile-breakpoint) {
    &.el-dialog {
      width: 95% !important;
      margin: 20px auto !important;
      max-height: 90vh;

      .el-dialog__header {
        padding: 0;

        .el-dialog__title {
          font-size: 16px;
          font-weight: 600;
        }
      }

      .el-dialog__body {
        padding: 0;
        max-height: calc(90vh - 160px);
        overflow-y: auto;
      }

      .el-dialog__footer {
        padding: 12px 20px 16px;

        .el-button {
          width: 100%;
          margin-bottom: 8px;

          &:last-child {
            margin-bottom: 0;
          }
        }
      }
    }
  }
}

// 移动端导航优化
.mobile-nav {
  @media (max-width: @mobile-breakpoint) {
    .el-menu {
      .el-menu-item {
        height: 48px;
        line-height: 48px;
        font-size: 14px;

        .el-icon {
          margin-right: 8px;
        }
      }

      .el-sub-menu {
        .el-sub-menu__title {
          height: 48px;
          line-height: 48px;
          font-size: 14px;
        }
      }
    }
  }
}

// 移动端内容区域优化
.mobile-content {
  @media (max-width: @mobile-breakpoint) {
    .content-wrap {
      padding: 12px;

      .el-card {
        margin-bottom: 12px;

        .el-card__body {
          padding: 12px;
        }
      }
    }
  }
}

// 移动端工具栏优化
.mobile-toolbar {
  @media (max-width: @mobile-breakpoint) {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;

    .toolbar-item {
      display: flex;
      align-items: center;
      gap: 8px;

      .el-button {
        flex: 1;
      }
    }
  }
}

// 移动端标签页优化
.mobile-tabs {
  @media (max-width: @mobile-breakpoint) {
    .el-tabs {
      .el-tabs__header {
        margin-bottom: 12px;

        .el-tabs__nav-wrap {
          .el-tabs__nav {
            .el-tabs__item {
              padding: 0 12px;
              font-size: 14px;
              height: 36px;
              line-height: 36px;
            }
          }
        }
      }

      .el-tabs__content {
        padding: 0 12px;
      }
    }
  }
}

// 移动端输入框优化
.mobile-input {
  @media (max-width: @mobile-breakpoint) {
    .el-input {
      .el-input__inner {
        height: 40px;
        line-height: 40px;
        font-size: 14px;
      }
    }

    .el-select {
      .el-input__inner {
        height: 40px;
        line-height: 40px;
      }
    }

    .el-date-picker {
      .el-input__inner {
        height: 40px;
        line-height: 40px;
      }
    }
  }
}

// 移动端加载状态优化
.mobile-loading {
  @media (max-width: @mobile-breakpoint) {
    .el-loading-mask {
      .el-loading-spinner {
        margin-top: -25px;

        .circular {
          width: 42px;
          height: 42px;
        }

        .el-loading-text {
          margin-top: 15px;
          font-size: 14px;
        }
      }
    }
  }
}

// 移动端消息提示优化
.mobile-message {
  @media (max-width: @mobile-breakpoint) {
    .el-message {
      min-width: 280px;
      max-width: 90vw;
      margin: 0 auto;

      .el-message__content {
        font-size: 14px;
        line-height: 1.4;
      }
    }
  }
}

// 移动端滚动条优化
.mobile-scrollbar {
  @media (max-width: @mobile-breakpoint) {
    .el-scrollbar {
      .el-scrollbar__wrap {
        overflow-x: auto;

        &::-webkit-scrollbar {
          width: 4px;
          height: 4px;
        }

        &::-webkit-scrollbar-thumb {
          background: #c0c4cc;
          border-radius: 2px;
        }
      }
    }
  }
}

// 隐藏移动端不需要的元素
.hide-on-mobile {
  @media (max-width: @mobile-breakpoint) {
    display: none !important;
  }
}

// 仅在移动端显示
.show-on-mobile {
  display: none;

  @media (max-width: @mobile-breakpoint) {
    display: block !important;
  }
}

// 移动端弹性布局
.mobile-flex {
  @media (max-width: @mobile-breakpoint) {
    display: flex;
    flex-direction: column;
    gap: 12px;

    &.row {
      flex-direction: row;
      flex-wrap: wrap;

      > * {
        flex: 1;
        min-width: 0;
      }
    }
  }
}

// 移动端网格布局
.mobile-grid {
  @media (max-width: @mobile-breakpoint) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;

    &.two-columns {
      grid-template-columns: 1fr 1fr;
    }

    &.auto-fit {
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
  }
}
